package bairui.international.service.impl;

import bairui.international.model.domain.jpa.TB_Admin;
import bairui.international.service.Service_Admin_Generate;
import org.springframework.stereotype.Service;
import bairui.international.dao.jpa.Repository_Admin;

/**
 *
 */
@Service
public class Service_AdminImpl_Generate
	implements Service_Admin_Generate
{

	
	@org.springframework.beans.factory.annotation.Autowired
	private Repository_Admin dao;

	@org.springframework.beans.factory.annotation.Autowired
	private com.lianjing.sh.project.authority.service.Service_RoleBase service_RoleBase;

	@org.springframework.beans.factory.annotation.Autowired
	private com.lianjing.sh.project.authority.service.Service_RoleGroup service_RoleGroup;

	@org.springframework.beans.factory.annotation.Autowired
	private com.lianjing.sh.project.authority.service.Service_NoticeBase service_NoticeBase;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_Role service_Role;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_Group service_Group;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_Department service_Department;



	
	
	
	/**
	 * deleteById
	 */
	public void deleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_Admin bean = getDao().findById(id).get();
		// createdRoleBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase> createdRoleBases = service_RoleBase.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdRoleBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase item : createdRoleBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdRoleBases", str);
		}
		// lastModifiedRoleBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase> lastModifiedRoleBases = service_RoleBase.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedRoleBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase item : lastModifiedRoleBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedRoleBases", str);
		}
		// createdRoleGroups
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup> createdRoleGroups = service_RoleGroup.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdRoleGroups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleGroup.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup item : createdRoleGroups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdRoleGroups", str);
		}
		// lastModifiedRoleGroups
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup> lastModifiedRoleGroups = service_RoleGroup.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedRoleGroups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleGroup.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup item : lastModifiedRoleGroups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedRoleGroups", str);
		}
		// createdNoticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> createdNoticeBases = service_NoticeBase.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdNoticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : createdNoticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdNoticeBases", str);
		}
		// lastModifiedNoticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> lastModifiedNoticeBases = service_NoticeBase.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedNoticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : lastModifiedNoticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedNoticeBases", str);
		}
		// noticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> noticeBases = service_NoticeBase.page(it->it.operatorBases.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!noticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : noticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "noticeBases", str);
		}
		// roles
		java.util.List<bairui.international.model.domain.jpa.TB_Role> roles = service_Role.page(it->it.admins.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!roles.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Role.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Role item : roles){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "roles", str);
		}
		// groups
		java.util.List<bairui.international.model.domain.jpa.TB_Group> groups = service_Group.page(it->it.admins.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!groups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Group.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Group item : groups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "groups", str);
		}
		// leadDepartment
		java.util.List<bairui.international.model.domain.jpa.TB_Department> leadDepartment = service_Department.page(it->it.head.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!leadDepartment.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Department.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Department item : leadDepartment){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "leadDepartment", str);
		}
		getDao().deleteById(id);
	}
	/**
	 * findDeleteById
	 */
	public TB_Admin findDeleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_Admin bean = getDao().findById(id).get();
		// createdRoleBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase> createdRoleBases = service_RoleBase.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdRoleBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase item : createdRoleBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdRoleBases", str);
		}
		// lastModifiedRoleBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase> lastModifiedRoleBases = service_RoleBase.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedRoleBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleBase item : lastModifiedRoleBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedRoleBases", str);
		}
		// createdRoleGroups
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup> createdRoleGroups = service_RoleGroup.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdRoleGroups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleGroup.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup item : createdRoleGroups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdRoleGroups", str);
		}
		// lastModifiedRoleGroups
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup> lastModifiedRoleGroups = service_RoleGroup.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedRoleGroups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_RoleGroup.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_RoleGroup item : lastModifiedRoleGroups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedRoleGroups", str);
		}
		// createdNoticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> createdNoticeBases = service_NoticeBase.page(it->it.creator.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!createdNoticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : createdNoticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "createdNoticeBases", str);
		}
		// lastModifiedNoticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> lastModifiedNoticeBases = service_NoticeBase.page(it->it.lastModifier.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!lastModifiedNoticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : lastModifiedNoticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "lastModifiedNoticeBases", str);
		}
		// noticeBases
		java.util.List<com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase> noticeBases = service_NoticeBase.page(it->it.operatorBases.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!noticeBases.isEmpty()){
			String str = "("+bean.toString()+")正在被("+com.lianjing.sh.project.authority.model.domain.jpa.TTB_NoticeBase.Comment+":[";
			boolean startFlag = true;
			for(com.lianjing.sh.project.authority.model.domain.jpa.TB_NoticeBase item : noticeBases){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "noticeBases", str);
		}
		// roles
		java.util.List<bairui.international.model.domain.jpa.TB_Role> roles = service_Role.page(it->it.admins.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!roles.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Role.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Role item : roles){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "roles", str);
		}
		// groups
		java.util.List<bairui.international.model.domain.jpa.TB_Group> groups = service_Group.page(it->it.admins.any().eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!groups.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Group.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Group item : groups){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "groups", str);
		}
		// leadDepartment
		java.util.List<bairui.international.model.domain.jpa.TB_Department> leadDepartment = service_Department.page(it->it.head.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!leadDepartment.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_Department.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_Department item : leadDepartment){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "leadDepartment", str);
		}
		getDao().deleteById(id);
		return bean;
	}
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull Long ... ids
	) throws Exception {
		deleteByIds(java.util.Arrays.asList(ids));
	}
	
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull java.util.List<Long> ids
	) throws Exception {
		for(Long id : ids){
			deleteById(id);
		}
	}
		






	/**
	 * getDao()
	 */
	public bairui.international.dao.jpa.Repository_Admin getDao() {
		return dao;
	}

}
